using Unity.Mathematics;
using UnityEngine;

public class Crow : Obstacle
{
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    bool isFly;
    public float attackRange,speed;
    
    public GameObject plane;
    void Start()
    {
        isFly=false;
    }

    // Update is called once per frame
    void Update()
    {
        base.Update();
        if(transform.position.x-Bubble.I.transform.position.x<attackRange && !isFly)
        {
            //更改图片为飞行模式
            plane.SetActive(true);
            isFly=true;
        }
        if(isFly)
        {
            transform.position+=Vector3.left*speed*Time.deltaTime;
        }
    }
}
